'use strict'
const cluster = require('cluster')
if (cluster.isMaster) {
  cluster.fork()
  cluster.on('disconnect', function (workder) {
    cluster.fork()
  })
} else {
  const convert = require('koa-convert')
  var Koa = require('koa')
  var app = new Koa()
  var path = require('path')
  var fileServer = require('koa-static')
  app.use(convert(fileServer(path.resolve(__dirname, 'dist'), {
    maxage: 24 * 60 * 60
  })))
  var server = require('http')
    .Server(app.callback())
  server.listen(3000)
  var io = require('socket.io')(server)
  const WebProcess = require('./core/webprocess')
  var web = new WebProcess(io)
}
